<template name="trailerStars">
	<view class="movie-score-wapper">

		<image v-for="(item,index) in yellowScore" src="../static/icons/star-yellow.png" class="star-ico" mode="">
		</image>
		<image v-for="(item,index) in grayScore" src="../static/icons/star-gray.png" class="star-ico" mode=""></image>
		<view class="movie-score" v-if="showNum === '1'">
			{{innerScore}}
		</view>

	</view>
</template>

<script>
	export default {
		name: "trailerStars",
		props: {
			innerScore: 0, // 定义外部传入分数
			showNum: 0 // 1显示，0不显示
		},
		data() {
			return {
				yellowScore: 0,
				grayScore: 5
			};
		},
		created() {
			this.yellowScore = parseInt(this.innerScore / 2)
			this.grayScore = 5 - this.yellowScore
		}
	}
</script>

<style scoped>
	.movie-score-wapper {
		display: flex;
		margin-bottom: 15rpx;
		align-items: center;
	}

	.star-ico {
		width: 20rpx;
		height: 20rpx;
		/* margin-left: 8rpx; */
		/* margin-top: 6rpx;
		 */
	}

	.movie-score {
		font-size: 12px;
		color: #000;
		line-height: 20rpx;
		margin-left: 10rpx;
	}
</style>
